Skip to content

Conversation

@byronz
Copy link
Contributor

@byronz byronz commented Jul 31, 2019

this fixes #841

Start with a description of this PR. Then edit the list below to the items that make sense for your PR scope, and check off the boxes as you go!

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • using python3.7 for percy and compare the performance
    • use headless mode for integration and compare the performance
    • improve CI performance by running integration in parallel and distribute build time
  • I have run the tests locally and they passed. (refer to testing section in contributing)

byron added 4 commits July 30, 2019 23:59
🐛 fix snapshot name conflict
⚡ speed up race cond
🚀 boost CI speed
@byronz
Copy link
Contributor Author

byronz commented Jul 31, 2019

@byronz byronz marked this pull request as ready for review July 31, 2019 04:07
. venv/bin/activate
pytest --junitxml=test-reports/junit_intg.xml tests/integration/
cd packages && ls -la && pip install * && cd .. && pip list | grep dash
TESTFILES=$(circleci tests glob "tests/integration/**/test_*.py" | circleci tests split --split-by=timings)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

circleci way to split and select tests based on previous execution duration infos

docker:
- image: percyio/agent
steps:
- run: percy finalize --all
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works together with a PERCY_PARALLEL_TOTAL: '-1' in test job, percy command will compare the number of containers by fetching ENV variable value from circleci.

- run: echo $PYVERSION > ver.txt
- restore_cache:
key: v-{{ checksum "circlejob.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cache key formula might need further tuning later

@byronz
Copy link
Contributor Author

byronz commented Jul 31, 2019

the whole config.yml can be improved using some new features in version 2.1, but out of the scope of this PR => speed up the CI time.

@byronz
Copy link
Contributor Author

byronz commented Jul 31, 2019

we might need to change the documents as the current change have an impact on local circlecli runs.



DELAY_TIME = 1
DELAY_TIME = 0.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh that in itself should be a huge speedup. Should be just fine - if for some reason that's ever not a long enough delay to actually have the responses arrive at the front end in the desired order, it would be a (presumably rare) missed test, or testing a different order, but one that should still be valid. So I'm happy to make this change, but some day we should refactor this test to something a little smarter that actually triggers the responses based on evidence that the previous response has been received and acted upon, rather than just time.

self.wait_for_text_to_equal('#output-post-payload', '{"output":"output-1.children","changedPropIds":["input.value"],"inputs":[{"id":"input","property":"value","value":"fire request hooks"}]}')
self.wait_for_text_to_equal('#output-post-response', '{"props":{"children":"fire request hooks"}}')
self.percy_snapshot(name='request-hooks')
self.percy_snapshot(name='request-hooks render')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh interesting - was one of these snapshots blocking the other one previously? How did you discover this? Do we need some additional mechanism (like a list of previously-used names inside percy_snapshot - though I guess in this case that wouldn't help as one's the new framework and the other is still using the old system) to ensure we don't double up a name again?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I guess the next question: do these two tests actually both have distinct value, or should we delete one of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a 400 error when the test job start to have parallelism > 1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh weird - so it allows multiple snapshots with the same name from the same process but not from different processes? very strange, though useful I guess as any test we do in our own code could only catch duplicates in the same process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was another issue with the previous approach, as we spin up a browser per test vs per session, the percy_finalize was called after each test case.

anyway, there are some extra integration under the hood from percy client, it adds some extra protection for all major CI tools.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it - right, it's probably the extra finalizing that buried the duplicate, and now percy will be taking care of ensuring uniqueness.

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 Thanks for doing this, should make us all more productive!

@byronz byronz merged commit 109821f into master Jul 31, 2019
@byronz byronz deleted the ci-speedup branch July 31, 2019 18:46
@rpkyle rpkyle mentioned this pull request May 22, 2020
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] CI Improvement

3 participants